package com.sendtion.xrichtextdemo.bean;

import java.io.Serializable;
import java.util.Objects;

/**
 * Note
 *
 * @since 2021-06-22
 */
public class Note implements Serializable, Comparable<Note> {
    /**
     * fileName
     *
     */
    public String fileName;
    private int id;
    private int groupId;
    private int type;
    private int isEncrypt;
    private String title;
    private String content;
    private String groupName;
    private String bgColor;
    private String createTime;
    private String updateTime;
    private long time;

    /**
     * Note
     *
     * @param toString
     * @param fileName
     */
    public Note(String toString, String fileName) {
        this.content = toString;
        this.fileName = fileName;
    }

    /**
     * Note
     *
     */
    public Note() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getBgColor() {
        return bgColor;
    }

    public void setBgColor(String bgColor) {
        this.bgColor = bgColor;
    }

    public int getIsEncrypt() {
        return isEncrypt;
    }

    public void setIsEncrypt(int isEncrypt) {
        this.isEncrypt = isEncrypt;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getFileName() {
        return fileName;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Note note = (Note) o;
        return id == note.id &&
                groupId == note.groupId &&
                type == note.type &&
                isEncrypt == note.isEncrypt &&
                time == note.time &&
                Objects.equals(fileName, note.fileName) &&
                Objects.equals(title, note.title) &&
                Objects.equals(content, note.content) &&
                Objects.equals(groupName, note.groupName) &&
                Objects.equals(bgColor, note.bgColor) &&
                Objects.equals(createTime, note.createTime) &&
                Objects.equals(updateTime, note.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fileName, id, groupId, type, isEncrypt, title, content, groupName, bgColor, createTime, updateTime, time);
    }

    @Override
    public int compareTo(Note note) {
        long l = this.getTime() - note.getTime();
        return (int)l;
    }
}
